package com.bwie.controller;

import com.bwie.pojo.TbOrder;
import com.bwie.pojo.TbProdInfo;
import com.bwie.service.TbOrderService;
import com.bwie.utils.R;
import com.bwie.utils.Result;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @projectName: server-2211a-shop
 * @package: com.bwie.controller
 * @className: TbOderController
 * @author: 杨珂
 * @description: TODO
 * @date: 2025/6/2 16:05
 * @version: 1.0
 */
@RestController
@RequestMapping("/shop/order")
public class TbOderController {

    @Autowired
    TbOrderService tbOrderService;


    /**
     * @param :
     * @return Result
     * @author :杨珂
     * @description 购买商品下订单
     * @date 2025/6/2 16:16
     */
    @PostMapping("/addOrder")
    public Result addOrder(@RequestBody List<TbProdInfo> prodInfoList) {
        return tbOrderService.addOrder(prodInfoList);
    }


    @PostMapping("/getOrderList")
    public Result getOrderList(@RequestBody PageInfoVo pageInfoVo) {
        return tbOrderService.getOrderList(pageInfoVo);
    }

    @PostMapping("/delOrderAll")
    public Result delOrderAll(@RequestBody List<TbOrder> orderList) {
        return tbOrderService.delOrderAll(orderList);
    }

    @GetMapping("/exportOderExcel/{ids}")
    public void exportOderExcel(@PathVariable("ids") String ids) {
        tbOrderService.exportOderExcel(ids);
    }

}
